<html>
    <head>
        <title>Mobile Info</title>
        
        <style type="text/css">
        </style>
        
        <script type="text/javascript">
            function onWidgetLoad() {
                var menu = widget.menu;

                menu1001 = menu.createMenuItem(1001);
                menu1001.text = "Refresh";
                menu1001.onSelect = onRefresh;
                menu.setSoftKey(menu1001, menu.leftSoftKeyIndex);

                var menu1002 = menu.createMenuItem(1002);
                menu1002.text = "About";
                menu1002.onSelect = onAbout;
                menu.append(menu1002);

                onRefresh();
            }

            function onRefresh() {
                var systemState = widget.createObject("SystemState");

                var html = "<b>Cradle Present</b><br/>";
                html += systemState.CradlePresent + "<br/><br/>";

                html += "<b>Display Rotation</b><br/>";
                html += systemState.DisplayRotation + "<br/><br/>";

                html += "<b>Phone Home Service</b><br/>";
                html += systemState.PhoneHomeService + "<br/><br/>";

                html += "<b>Phone Operator Name</b><br/>";
                html += systemState.PhoneOperatorName + "<br/><br/>";

                html += "<b>Phone Roaming</b><br/>";
                html += systemState.PhoneRoaming + "<br/><br/>";

                html += "<b>Phone Signal Strength</b><br/>";
                html += systemState.PhoneSignalStrength + "<br/><br/>";

                // [CF] - TODO - decode these last two properties like we did in the C#/C versions... (i.e. decode bitmasks and enumeration values)
                html += "<b>Power Battery State</b><br/>";
                html += systemState.PowerBatteryState + "<br/><br/>";

                html += "<b>Power Battery Strength</b><br/>";
                html += systemState.PowerBatteryStrength;

                lblResults.innerHTML = html;
            }

            function onAbout() {
                alert("TODO - display about dialog...");
            }
        </script>
    </head>
    
    <body onload="onWidgetLoad();">
        <div id="lblResults" />
    </body>
</html>